package com.example.bhservice.tools;

//import sun.security.krb5.internal.crypto.Aes256;
//import sun.security.krb5.internal.crypto.DesCbcCrcEType;

import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;
import java.util.Base64;

public class jiami {
    //    des加密
//    public static String des(String str, String key) {
//        SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "DES");
//        try {
//            Cipher cipher = Cipher.getInstance("DES");
//            cipher.init(Cipher.ENCRYPT_MODE, keySpec);
//            byte[] encrypted = cipher.doFinal(str.getBytes(StandardCharsets.UTF_8));
//            return Base64.getEncoder().encodeToString(encrypted);
//        } catch (Exception e) {
//            throw new RuntimeException(e);
//        }
//    }

//    md5加密
//    public static String md5(String str) {
//        try {
//            java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5");
//            byte[] array = md.digest(str.getBytes(StandardCharsets.UTF_8));
//            StringBuilder sb = new StringBuilder();
//            for (byte b : array) {
//                sb.append(Integer.toHexString((b & 0xFF) | 0x100), 1, 3);
//            }
//            return sb.toString();
//        } catch (Exception e) {
//            throw new RuntimeException(e);
//        }
//    }
}
